The user controls the colors used for the window frame and text highlighting through the Color control panel. Ordinarily, your application doesn't override the user's color choices, which are stored in a default window color table. If you have some extraordinary need to control window colors, you can do so by defining window color tables for your application's windows.
The Window Manager maintains window color information tables in a data structure of type WinCTab .
You can define your own window color table and apply it to an existing window through the SetWinColor function (SetWinColor) .
To establish the window color table for a window when you create it, you provide a window color table ( 'wctb' ) resource with the same resource ID as the 'WIND' resource that defines the window.
The WCTabPtr data type is a pointer to a window color table record, and the WTabHandle is a handle to a window color table record. The WinCTab data type defines a window color table record.
struct WinCTab {
long wCSeed; /* reserved */
short wCReserved; /* reserved */
short ctSize; /* number of entries in table --1*/
ColorSpec ctTable[5]; /* array of color specification */
/* records */
};
typedef struct WinCTab WinCTab;
typedef WinCTab *WCTabPtr, **WCTabHandle;
struct ColorSpec {
short value; /* part identifier */
RGBColor rgb; /* RGB value */
};
The part codes in System 5 and System 6 are significantly different from the part codes described here, which apply only to System 7 .
When your application creates a window, the Window Manager first looks for a resource of type 'wctb' with the same resource ID as the 'WIND' resource used for the window. If it finds one, it creates a window color table for the window from the information in that resource, and then displays the window in those colors. If it doesn't find a window color table resource with the same resource ID as your window resource, the Window Manager uses the default system window color table, read into the heap during application startup.
After creating a window, you can change the entries in a window's window color table with the SetWinColor function SetWinColor .
See "The Window Color Table Resource" for a description of the window color table resource.